/// API端点常量类
/// 集中管理所有API请求路径
class ApiEndpoints {
  ApiEndpoints._();
  
  /// 基础URL
  static const String baseUrl = 'https://api.hiot.com';
  
  /// API版本
  static const String apiVersion = 'v1';
  
  /// 获取完整的API路径
  static String getFullPath(String path) => '$baseUrl/$apiVersion/$path';
  
  /// 认证相关
  static final auth = _AuthEndpoints();
  
  /// 用户相关
  static final user = _UserEndpoints();
  
  /// 设备相关
  static final device = _DeviceEndpoints();
  
  /// 数据相关
  static final data = _DataEndpoints();

  // 基础认证相关接口
  static const String login = '/auth/login';
  static const String register = '/auth/register';
  static const String logout = '/auth/logout';
  static const String refreshToken = '/auth/refresh-token';
  static const String verifyToken = '/auth/verify-token';
  static const String forgotPassword = '/auth/forgot-password';
  static const String resetPassword = '/auth/reset-password';
  static const String changePassword = '/auth/change-password';
  
  // 用户相关接口
  static const String users = '/users';
  static const String userProfile = '/users/profile';
  static const String updateProfile = '/users/profile';
  static String getUserDetail(String userId) => '/users/$userId';
  
  // 设备相关接口
  static const String devices = '/devices';
  static const String deviceTypes = '/devices/types';
  static String getDeviceDetail(String deviceId) => '/devices/$deviceId';
  static String getDeviceControl(String deviceId) => '/devices/$deviceId/control';
  static String getDeviceData(String deviceId) => '/devices/$deviceId/data';
  static String getDeviceAlarms(String deviceId) => '/devices/$deviceId/alarms';
  
  // 仪表盘相关接口
  static const String dashboard = '/dashboard';
  static const String dashboardSummary = '/dashboard/summary';
  static const String dashboardStats = '/dashboard/stats';
  
  // 告警相关接口
  static const String alarms = '/alarms';
  static const String alarmsStats = '/alarms/stats';
  static const String alarmsSeverity = '/alarms/severity';
  static String getAlarmDetail(String alarmId) => '/alarms/$alarmId';
  static String acknowledgeAlarm(String alarmId) => '/alarms/$alarmId/acknowledge';
  
  // 通知相关接口
  static const String notifications = '/notifications';
  static const String notificationsSettings = '/notifications/settings';
  static String readNotification(String notificationId) => '/notifications/$notificationId/read';
  static const String readAllNotifications = '/notifications/read-all';
  
  // 系统配置接口
  static const String systemSettings = '/system/settings';
  static const String systemInfo = '/system/info';
  static const String systemHealth = '/system/health';
  
  // 文件上传接口
  static const String uploadFile = '/upload';
  static const String uploadAvatar = '/upload/avatar';
}

/// 认证相关端点
class _AuthEndpoints {
  /// 登录
  String get login => ApiEndpoints.getFullPath('auth/login');
  
  /// 注册
  String get register => ApiEndpoints.getFullPath('auth/register');
  
  /// 刷新令牌
  String get refreshToken => ApiEndpoints.getFullPath('auth/refresh-token');
  
  /// 忘记密码
  String get forgotPassword => ApiEndpoints.getFullPath('auth/forgot-password');
  
  /// 重置密码
  String get resetPassword => ApiEndpoints.getFullPath('auth/reset-password');
  
  /// 登出
  String get logout => ApiEndpoints.getFullPath('auth/logout');
}

/// 用户相关端点
class _UserEndpoints {
  /// 获取用户信息
  String get profile => ApiEndpoints.getFullPath('users/profile');
  
  /// 更新用户信息
  String get updateProfile => ApiEndpoints.getFullPath('users/profile');
  
  /// 更改密码
  String get changePassword => ApiEndpoints.getFullPath('users/change-password');
  
  /// 获取用户列表
  String get list => ApiEndpoints.getFullPath('users');
  
  /// 获取特定用户
  String user(String userId) => ApiEndpoints.getFullPath('users/$userId');
}

/// 设备相关端点
class _DeviceEndpoints {
  /// 获取设备列表
  String get list => ApiEndpoints.getFullPath('devices');
  
  /// 获取特定设备
  String device(String deviceId) => ApiEndpoints.getFullPath('devices/$deviceId');
  
  /// 控制设备
  String control(String deviceId) => ApiEndpoints.getFullPath('devices/$deviceId/control');
  
  /// 添加设备
  String get add => ApiEndpoints.getFullPath('devices');
  
  /// 删除设备
  String delete(String deviceId) => ApiEndpoints.getFullPath('devices/$deviceId');
  
  /// 更新设备
  String update(String deviceId) => ApiEndpoints.getFullPath('devices/$deviceId');
  
  /// 获取设备状态
  String status(String deviceId) => ApiEndpoints.getFullPath('devices/$deviceId/status');
}

/// 数据相关端点
class _DataEndpoints {
  /// 获取设备历史数据
  String history(String deviceId) => ApiEndpoints.getFullPath('data/$deviceId/history');
  
  /// 获取设备实时数据
  String realtime(String deviceId) => ApiEndpoints.getFullPath('data/$deviceId/realtime');
  
  /// 获取统计数据
  String statistics(String deviceId) => ApiEndpoints.getFullPath('data/$deviceId/statistics');
  
  /// 导出数据
  String export(String deviceId) => ApiEndpoints.getFullPath('data/$deviceId/export');
} 